include(${CMAKE_SOURCE_DIR}/cmake/options/options_definitions.cmake)
# 自动初始化所有选项为OFF
foreach(opt_desc IN LISTS OPTION_DEFINITIONS)
    string(REGEX REPLACE ":.*" "" opt_id ${opt_desc})
    string(TOUPPER ${opt_id} opt_upper)
    set(ENABLE_${opt_upper} OFF CACHE INTERNAL "Enable ${opt_desc}")
endforeach()

# 批量启用选项的函数
function(enable_options)
    foreach(opt IN LISTS ARGV)
        string(TOUPPER ${opt} opt_upper)

        # 检查选项是否在定义列表中
        set(option_valid FALSE)
        foreach(opt_desc IN LISTS OPTION_DEFINITIONS)
            string(REGEX REPLACE ":.*" "" opt_id ${opt_desc})
            if(opt_id STREQUAL opt)
                set(option_valid TRUE)
                break()
            endif()
        endforeach()

        if(option_valid)
            set(ENABLE_${opt_upper} ON CACHE INTERNAL "Enabled: ${opt}" FORCE)
            message(STATUS "[${opt_upper}]:ON")
        else()
            message(WARNING "[Unknown option]: ${opt}")
        endif()
    endforeach()
endfunction()